package com.xiaochen.user.controller;

import com.xiaochen.model.vo.common.Result;
import com.xiaochen.model.vo.common.ResultCodeEnum;
import com.xiaochen.user.service.SmsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 短信服务接口
 *
 * @author pinkhors
 */
@Tag(name = "验证码接口")
@RestController
@RequestMapping("/api/user/sms")
public class SmsController {

    @Autowired
    private SmsService smsService;

    @Operation(summary = "发送短信验证码")
    @GetMapping("/sendCode/{phone}")
    public Result sendSmsCode(@PathVariable String phone){
        smsService.sendSmsCode(phone);
        return Result.build(null, ResultCodeEnum.SUCCESS);
    }
}
